import { Component } from 'react'
import { connect } from 'react-redux'
// import { bindActionCreators } from 'redux'
import Taro from '@tarojs/taro'
import { View, Text } from '@tarojs/components'
import { AtGrid, AtButton } from 'taro-ui'
import './index.scss'

const coverData = [
  {
    image: 'https://img12.360buyimg.com/jdphoto/s72x72_jfs/t6160/14/2008729947/2754/7d512a86/595c3aeeNa89ddf71.png',
    value: '空间租赁',
    url: '/pages/appointment/index'
  },
  {
    image: 'https://img20.360buyimg.com/jdphoto/s72x72_jfs/t15151/308/1012305375/2300/536ee6ef/5a411466N040a074b.png',
    value: '活动入口',
    url: '/pages/activity/index'
  },
  {
    image: 'https://img10.360buyimg.com/jdphoto/s72x72_jfs/t5872/209/5240187906/2872/8fa98cd/595c3b2aN4155b931.png',
    value: '空间进驻',
    url: '/pages/spaceEntry/index'
  },
  {
    image: 'https://img12.360buyimg.com/jdphoto/s72x72_jfs/t10660/330/203667368/1672/801735d7/59c85643N31e68303.png',
    value: '众创地图',
    url: '/pages/myMap/index'
  },
  // {
  //   image: 'https://img14.360buyimg.com/jdphoto/s72x72_jfs/t17251/336/1311038817/3177/72595a07/5ac44618Na1db7b09.png',
  //   value: '未开通'
  // },
  // {
  //   image: 'https://img30.360buyimg.com/jdphoto/s72x72_jfs/t5770/97/5184449507/2423/294d5f95/595c3b4dNbc6bc95d.png',
  //   value: '未开通'
  // }
]

// 使用bindActionCreators时
// @connect(
//   ({ counter }) => ({ counter }),
//   dispatch => bindActionCreators({ add, dec: minus , asyncAdd }, dispatch)
// )
@connect(null,null)

class Index extends Component {
  componentDidMount() {}

  componentWillUnmount() { }

  componentDidShow() { }

  componentDidHide() { }

  jumpLogin = () => {
    Taro.navigateTo({
      url: '/pages/login/index'
    })
  }

  moduleClick = ({ url }) => {
    if (url) {
      Taro.navigateTo({ url })
    }
  }

  render () {
    return (
      <View className=''>
        <View>
          <Text>首页</Text>
        </View>
        <AtGrid data={coverData} hasBorder={false} columnNum={4} onClick={this.moduleClick} />
        <AtButton type='primary' onClick={this.jumpLogin}>
          跳转登录
        </AtButton>
      </View>
    )
  }
}

export default Index
